package runnable;
/*、通过实现java.lang.Runnable接口的方式创建一个新线程，要求main线程打印100次”main”，新线程打印50次“new”。*/
public class MyThread implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 50; i++) {

            System.out.println(Thread.currentThread().getName() +  (i + 1) + "new");
        }
    }

    public static void main(String[] args) {

        Thread thread = new Thread(new MyThread(),"牛哥");
        thread.start();
        for (int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + (i + 1) + "main");
        }
    }
}
